package com.aliothservice.catfish.device.data;

import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.springframework.data.annotation.Id;

import com.aliothservice.catfish.product.data.VehiclePending;

public class VehicleBindingRequest {
	
	public static final String STATUS_CREATED = "created";
	public static final String STATUS_OPEN = "open";
	public static final String STATUS_CLOSED = "closed";
	
	public Map<String, Object> toMap() {
		Map<String, Object> map = new HashMap<String, Object>();
		
		map.put("id", this.getId());
		map.put("contactName", this.getContactName());
		map.put("contactPhoneNumber", this.getContactPhoneNumber());
		map.put("pendingObject", this.pendingObject.toMap());
		if (null != this.getNotes()) {
			map.put("notes", this.getNotes());
		}
		DateFormat fullFormatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss:SSS");
		map.put("creationDate", fullFormatter.format(this.getCreationDate()));
		
		return map;
	}
	
	@Id
	private String id;
	
	private String userId;
	
	private String contactName;
	private String contactPhoneNumber;
	
	// vehicle info - referenced by pending id
	private String pendingId;
	private VehiclePending pendingObject;
	
	private List<Map<String, String>> notes;
	
	private String status;
	
	private Date creationDate;

	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public String getContactName() {
		return contactName;
	}

	public void setContactName(String contactName) {
		this.contactName = contactName;
	}

	public String getContactPhoneNumber() {
		return contactPhoneNumber;
	}

	public void setContactPhoneNumber(String contactPhoneNumber) {
		this.contactPhoneNumber = contactPhoneNumber;
	}

	public String getPendingId() {
		return pendingId;
	}

	public void setPendingId(String pendingId) {
		this.pendingId = pendingId;
	}

	public List<Map<String, String>> getNotes() {
		return notes;
	}

	public void setNotes(List<Map<String, String>> notes) {
		this.notes = notes;
	}

	public String getUserId() {
		return userId;
	}

	public void setUserId(String userId) {
		this.userId = userId;
	}

	public String getStatus() {
		return status;
	}

	public void setStatus(String status) {
		this.status = status;
	}

	public Date getCreationDate() {
		return creationDate;
	}

	public void setCreationDate(Date creationDate) {
		this.creationDate = creationDate;
	}

	public VehiclePending getPendingObject() {
		return pendingObject;
	}

	public void setPendingObject(VehiclePending pendingObject) {
		this.pendingObject = pendingObject;
	}

}
